package com.youngjun.user.api.admin;

import com.youngjun.common.mybatis.web.Response;
import com.youngjun.user.pojo.dto.FunctionDTO;
import com.youngjun.user.pojo.vo.FunctionVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Api(tags = "功能管理")
@FeignClient(
        name = "${ums.api.name:ums-service}",
        contextId = "functionRestApi",
        url  = "${ums.api.url:http://127.0.0.1:8080}",
        path = "/function"
)
public interface IFunctionRestApi {

    @ApiOperation(value="查询功能信息")
    @RequestMapping(method = RequestMethod.GET, path = "/query_allow_access_function_list")
    Response<List<FunctionVO>> queryAllowAccessFunctionList(Long roleId);

    @ApiOperation(value="查询功能信息")
    @RequestMapping(method = RequestMethod.GET, path = "/query_allow_assign_function_list")
    Response<List<FunctionVO>> queryAllowAssignFunctionList(Long roleId);

    @ApiOperation(value="查询功能信息")
    @RequestMapping(method = RequestMethod.GET, path = "/query_list")
    Response<List<FunctionVO>> queryList();

    @ApiOperation(value="创建功能信息")
    @RequestMapping(method = RequestMethod.POST, path = "/create")
    Response<FunctionVO> create(@RequestBody FunctionDTO dto);

    @ApiOperation(value="修改功能信息")
    @RequestMapping(method = RequestMethod.PUT, path = "/modify")
    Response<FunctionVO> modify(@RequestBody FunctionDTO dto);

    @ApiOperation(value="删除功能信息")
    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    Response<Void> delete(@RequestParam("id") Long id);

}